package com.yinp.proapp.module.game.tanchishe;

import android.view.View;

import com.yinp.proapp.base.activity.AppBaseActivity;
import com.yinp.proapp.databinding.ActivityGSGameContentBinding;
import com.yinp.proapp.utils.StatusBarUtil;

/**
 * @Author: yinp
 * @Date: 2021/9/7
 * @Description:贪吃蛇游戏的主题类容
 */
public class GSGameContentActivity extends AppBaseActivity<ActivityGSGameContentBinding> {

    @Override
    protected void initViews() {
        initClick(bd.header.headerBackImg, bd.stvUp, bd.stvLeft, bd.stvDown, bd.stvRight, bd.stvStop, bd.stvStart, bd.stvRestart);
        setStatusBarHeight(StatusBarUtil.getStatusBarHeight(mContext));
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        if (v == bd.header.headerBackImg) {
            finish();
        } else if (v == bd.stvUp) {
            bd.gsView.setDirection(1);
        } else if (v == bd.stvDown) {
            bd.gsView.setDirection(3);
        } else if (v == bd.stvLeft) {
            bd.gsView.setDirection(0);
        } else if (v == bd.stvRight) {
            bd.gsView.setDirection(2);
        } else if (v == bd.stvStop) {
            bd.gsView.stopMove();
        } else if (v == bd.stvStart) {
            bd.gsView.startMove();
        } else if (v == bd.stvRestart) {
            bd.gsView.reStart();
        }
    }
}